﻿
$(document).ready(function () {
    loading();

});
function loading() {
    if (!islogin()) { window.location.href = 'login.html'; return; }
    ajax.GetDetail("login=true", function (data) {
        if (data.code == 0) {
            $(data.item).each(function () {
                $("#userid").html("ID:" + this.id);
                $("#username").html(this.name);
                $("#version").html(this.version);
                $("#name").html(this.nick_name);
                $("#phone").html(this.phone);
                $("#QQ").html(this.qq);
                $("#Email").html(this.email);
                $("#tel").html(this.tel);
                if (this.end_date != null)
                    $("#end_date").html("有效期:" + this.end_date.substring(0, 10));
                var code = encodeURIComponent(this.wx_code);
                var public_code = encodeURIComponent(this.wx_public_code);
                $("#wx_code").bind("click", function () { window.location.href = 'update-ewm.html?src=' + code; });
                $("#wx_public_code").bind("click", function () { window.location.href = 'update-dyh.html?src=' + public_code; });

                if (this.logo != null) {
                    $(".Myings img").attr("src", this.logo);
                }
                SetCookie("parentid", this.parent_id);
                ChangeLogin(this.isupdate);  //微信登录，更换登录方式
            });
        }
        else
            Alert(data.msg);
    });
}

function toUrl(obj) {
    if (!islogin()) {
        window.location.href = 'login.html'; return; 
    }
    window.location.href = 'nickname.html?name=' + $(obj).children('.infomRight').html() + '&nick=' + $(obj).children().html();
}
function Upheadpont() {
    if (!islogin()) { window.location.href = 'login.html'; return; }
    ajax.UpdateInfo("logo=" + $("#Headpont").attr("src"), function (data) {
        if (data.msg.toString() != "成功") {
            Alert("上传异常！");
            $("#Headpont").attr("src", "img/39.png");
        }
    });
}
function login() {
    if (!islogin()) {
        window.location.href = 'login.html';
        return false;
    }
    return true;

}

